package dpyNotepad;
import javax.microedition.lcdui.*;

public class Encodings extends List {

	private Notepad notepad;
	
	public static final String UTF_8 = "UTF-8";
	public static final String US_ASCII = "US-ASCII";
	public static final String WINDOWS_1251 = "windows-1251";
	public static final String WINDOWS_1252 = "windows-1252";
	public static final String UTF8 = "UTF8";
	public static final String ASCII = "ASCII";
	public static final String WINDOWS1251 = "Cp1251";
	public static final String WINDOWS1252 = "Cp1252";
	
	public Encodings(String title, int type, Notepad notepad) {
		super(title, type);
		
		this.notepad = notepad;
		
		this.setCommandListener(this.notepad);
		this.addCommand(this.notepad.openPadCmd);
		this.addCommand(this.notepad.mainMenuCmd);
		
		this.append(UTF8, null);
		this.append(ASCII, null);
		this.append(WINDOWS1251, null);
		this.append(WINDOWS1252, null);
		this.append(UTF_8, null);
		this.append(US_ASCII, null);
		this.append(WINDOWS_1251, null);
		this.append(WINDOWS_1252, null);
	}
	
	public void handleCommand(){
		this.notepad.encoding = this.getString(this.getSelectedIndex());
		this.notepad.goToMainMenuExecute();
	}

}
